package vn.com.horoscope.activity;

import vn.com.horoscope.R;
import vn.com.horoscope.common.ConstantClass;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class CharacterTabActivity extends TabActivity {
	protected final static String tag = "vn.com.horoscope.test";
	
	private ImageView mZodiac;
	protected static int horoscopeId;
    
    private int[] imageId = new int[] {
    		R.drawable.bachduong,
    		R.drawable.kimnguu,
    		R.drawable.songtu,
    		R.drawable.cugiai,
    		R.drawable.sutu,
    		R.drawable.xunu,
    		R.drawable.thienbinh,
    		R.drawable.bocap,
    		R.drawable.nhanma,
    		R.drawable.maket,
    		R.drawable.baobinh,
    		R.drawable.songngu
    };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_character_tab);
		
		horoscopeId = getIntent().getIntExtra(ConstantClass.horoscopeParam, 0);
		this.mZodiac = (ImageView) findViewById(R.id.imgZodiac);
		this.mZodiac.setImageResource(imageId[horoscopeId - 1]);

		TabHost tabHost = getTabHost();

		
		// Tab for Character
		TabSpec characterSpec = tabHost.newTabSpec("character");
		characterSpec.setIndicator(getResources().getString(R.string.tinh_cach), null);
		Intent characterIntent = new Intent(this, TabCharacter.class);
		characterIntent.putExtra(ConstantClass.id,horoscopeId) ;
		characterSpec.setContent(characterIntent);

		// Tab for Love
		TabSpec loveSpec = tabHost.newTabSpec("love");
		loveSpec.setIndicator(getResources().getString(R.string.tinh_yeu), null);
		Intent loveIntent = new Intent(this, TabLove.class);
		loveIntent.putExtra(ConstantClass.id,horoscopeId) ;
		loveSpec.setContent(loveIntent);

		// Tab for Work
		TabSpec workSpec = tabHost.newTabSpec("work");
		workSpec.setIndicator(getResources().getString(R.string.su_nghiep), null);
		Intent workIntent = new Intent(this, TabWork.class);
		workIntent.putExtra(ConstantClass.id,horoscopeId) ;
		workSpec.setContent(workIntent);

		// Tab for Weak
		TabSpec weakSpec = tabHost.newTabSpec("weak");
		weakSpec.setIndicator(getResources().getString(R.string.diem_yeu), null);
		Intent weakIntent = new Intent(this, TabWeak.class);
		weakIntent.putExtra(ConstantClass.id,horoscopeId) ;
		weakSpec.setContent(weakIntent);

		
		// Add TabSpec to TabHost
		tabHost.addTab(weakSpec);
		tabHost.addTab(characterSpec);
		tabHost.addTab(loveSpec);
		tabHost.addTab(workSpec);
		
	}
}
